package com.kitchen.ui.dialog.task
{
	import com.kitchen.ui.box9grid.BetweenBox;
	import com.kitchen.ui.box9grid.InnerBox;
	import com.kitchen.ui.box9grid.OuterBox;
	import com.kitchen.ui.dialog.AbstractDialog;
	import com.kitchen.ui.dialog.DialogHeader;
	import com.kitchen.ui.dialog.com.StarIcon;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Loader;
	import flash.display.Shape;
	import flash.net.URLRequest;

	public class TaskDialog extends AbstractDialog
	{
		public function TaskDialog(main:BitmapData, dialog:BitmapData, shoper:Object=null, shop:Object=null)
		{
			super(main, dialog, shoper, shop);
		}
		
		override public function getData():Object{
			var data:Object = new Object();
			return data;
		}
		
		override protected function layout(cdata:Object):void{
			this.w = 680;
			this.h = 585;
			var outer:OuterBox = new OuterBox(this.dialogSkin, this.w, this.h-20);
			var between:BetweenBox = new BetweenBox(this.dialogSkin, 655, 475);
			var inner1:InnerBox = new InnerBox(this.dialogSkin, 245, 440);
			var inner2:InnerBox = new InnerBox(this.dialogSkin, 390, 440);
			outer.x = 0;
			outer.y = 20;
			between.x = 10;
			between.y = 95;
			inner1.x = 20;
			inner2.y = inner1.y = 115;
			inner2.x = 265;
			this.addChild(outer);
			this.addChild(between);
			this.addChild(inner1);
			this.addChild(inner2);
			
			var head:TaskHead = new TaskHead(this.mainSkin);
			head.x = (this.w-head.w)/2;
			head.y = 0;
			this.addChild(head);
			var lstar:StarIcon = new StarIcon(this.dialogSkin);
			var rstar:Bitmap = lstar.clone();
			lstar.x = (this.w -head.w-lstar.w)/2-25;
			rstar.x = this.w - (this.w -head.w-lstar.w)/2 + 25;
			this.addChild(lstar);
			rstar.scaleX = -1;
			this.addChild(rstar);
			this.addCloseButton();
			this.leftLayout();
		}
		
		private function leftLayout():void{
			var blackBox:Shape = new Shape();
			blackBox.graphics.beginFill(0x342716, 1);
			var redius:int = 12;
			blackBox.graphics.drawRoundRectComplex(0, 0, 220, 375, redius, redius, redius, redius);
			blackBox.graphics.endFill();
			blackBox.x = 32;
			blackBox.y = 127;
			this.addChild(blackBox);
			var loadimg:Loader = new Loader();
			loadimg.load(new URLRequest('/static/images/task.png'));
			loadimg.x = 35;
			loadimg.y = 132;
			this.addChild(loadimg);
			var cate:CatalogTask = new CatalogTask(this.dialogSkin);
			cate.x = 35;
			cate.y = 256;
			this.addChild(cate);
			var accept:AcceptTaskButton = new AcceptTaskButton(this.dialogSkin);
			accept.x = 65;
			accept.y = 508;
			this.addChild(accept);
			var taskContent:TaskContent = new TaskContent(this.dialogSkin);
			taskContent.x = 275;
			taskContent.y = 130;
			this.addChild(taskContent);
			var getPrise:GetPriseButton = new GetPriseButton(this.dialogSkin);
			getPrise.x = 425;
			getPrise.y = 508;
			this.addChild(getPrise);
		}
	}
}